﻿<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="Microsoft.Help.SelfBranded" content="true" />
    <meta name="Language" content="en-us" />
    <meta name="Microsoft.Help.Locale" content="en-us" />
    <meta name="Microsoft.Help.TopicLocale" content="en-us" />
    <link rel="shortcut icon" href="../icons/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="../styles/branding.css" />
    <link rel="stylesheet" type="text/css" href="../styles/branding-en-US.css" />
    <script type="text/javascript" src="../scripts/branding.js"></script>
    <title>SerializationHelp.DeepCopyByXmlSerializer&lt;T&gt; Method</title>
    <meta name="Title" content="DeepCopyByXmlSerializer&lt;T&gt; Method" />
    <meta name="Microsoft.Help.Id" content="M:SosoMS.Common.SystemHelp.SerializationHelp.DeepCopyByXmlSerializer``1(``0)" />
    <meta name="Microsoft.Help.ContentType" content="Reference" />
    <meta name="System.Keywords" content="SerializationHelp.DeepCopyByXmlSerializer&lt;T&gt; method" />
    <meta name="System.Keywords" content="DeepCopyByXmlSerializer&lt;T&gt; method" />
    <meta name="Microsoft.Help.F1" content="SosoMS.Common.SystemHelp.SerializationHelp.DeepCopyByXmlSerializer" />
    <meta name="Microsoft.Help.F1" content="SerializationHelp.DeepCopyByXmlSerializer" />
    <meta name="Microsoft.Help.F1" content="DeepCopyByXmlSerializer" />
    <meta name="container" content="SosoMS.Common.SystemHelp" />
    <meta name="file" content="0ca41180-d220-c9c1-0040-f2e6391b4806" />
    <meta name="guid" content="0ca41180-d220-c9c1-0040-f2e6391b4806" />
    <meta name="Description" content="使用将对象深拷贝" />
    <link rel="stylesheet" type="text/css" href="../styles/branding-Help1.css" />
  </head>
  <body onload="SetDefaultLanguage('cs');">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <div id="PageHeader" class="pageHeader">嗖嗖常用方法帮助集</div>
    <div class="pageBody">
      <div id="TopicContent" class="topicContent">
        <table class="titleTable">
          <tr>
            <td class="titleColumn">
              <h1>Serialization<wbr />Help<span id="LSTD4A2606B_0" data-languageSpecificText="cpp=::|nu=."></span>Deep<wbr />Copy<wbr />By<wbr />Xml<wbr />Serializer<span id="LSTD4A2606B_1" data-languageSpecificText="cpp=&lt;|cs=&lt;|fs=&lt;|vb=(Of |nu=("></span><span class="typeparameter">T</span><span id="LSTD4A2606B_2" data-languageSpecificText="cpp=&gt;|cs=&gt;|fs=&gt;|vb=)|nu=)"></span> Method</h1>
            </td>
          </tr>
        </table>
        <div class="summary">
            使用<a href="https://learn.microsoft.com/dotnet/api/system.xml.serialization.xmlserializer" target="_blank" rel="noopener noreferrer">XmlSerializer</a>将对象深拷贝
            </div>
        <br />
        <strong>Namespace:</strong> <a href="026ce1e1-007c-0e37-04b4-2e196fe75f90.htm">SosoMS.Common.SystemHelp</a><br /><strong>Assembly:</strong> SosoMS.Common (in SosoMS.Common.dll) Version: 1.0.0<div class="collapsibleAreaRegion"><span class="collapsibleRegionTitle" onclick="SectionExpandCollapse('IDB')" onkeypress="SectionExpandCollapse_CheckKey('IDB', event)" tabindex="0"><img id="IDBToggle" class="collapseToggle" src="../icons/SectionExpanded.png" />Syntax</span></div><div id="IDBSection" class="collapsibleSection"><div id="IDAB" class="codeSnippetContainer"><div class="codeSnippetContainerTabs"><div id="IDAB_tab1" class="codeSnippetContainerTab"><a href="#" onclick="ChangeTab('IDAB','cs','1','4');return false;">C#</a></div><div id="IDAB_tab2" class="codeSnippetContainerTab"><a href="#" onclick="ChangeTab('IDAB','vb','2','4');return false;">VB</a></div><div id="IDAB_tab3" class="codeSnippetContainerTab"><a href="#" onclick="ChangeTab('IDAB','cpp','3','4');return false;">C++</a></div><div id="IDAB_tab4" class="codeSnippetContainerTab"><a href="#" onclick="ChangeTab('IDAB','fs','4','4');return false;">F#</a></div></div><div class="codeSnippetContainerCodeContainer"><div class="codeSnippetToolBar"><div class="codeSnippetToolBarText"><a id="IDAB_copyCode" href="#" class="copyCodeSnippet" onclick="CopyToClipboard('IDAB');return false;" title="Copy">Copy</a></div></div><div id="IDAB_code_Div1" class="codeSnippetContainerCode" style="display: block"><pre xml:space="preserve"><span class="keyword">public</span> <span class="keyword">static</span> T <span class="identifier">DeepCopyByXmlSerializer</span>&lt;T&gt;(
	T <span class="parameter">instance</span>
)
<span class="keyword">where</span> T : <span class="keyword">new</span>()
</pre></div><div id="IDAB_code_Div2" class="codeSnippetContainerCode" style="display: none"><pre xml:space="preserve"><span class="keyword">Public</span> <span class="keyword">Shared</span> <span class="keyword">Function</span> <span class="identifier">DeepCopyByXmlSerializer</span>(<span class="keyword">Of</span> T <span class="keyword">As</span> <span class="keyword">New</span>) ( 
	<span class="parameter">instance</span> <span class="keyword">As</span> T
) <span class="keyword">As</span> T</pre></div><div id="IDAB_code_Div3" class="codeSnippetContainerCode" style="display: none"><pre xml:space="preserve"><span class="keyword">public</span>:
<span class="keyword">generic</span>&lt;<span class="keyword">typename</span> T&gt;
<span class="keyword">where</span> T : <span class="keyword">gcnew</span>()
<span class="keyword">static</span> T <span class="identifier">DeepCopyByXmlSerializer</span>(
	T <span class="parameter">instance</span>
)</pre></div><div id="IDAB_code_Div4" class="codeSnippetContainerCode" style="display: none"><pre xml:space="preserve"><span class="keyword">static</span> <span class="keyword">member</span> <span class="identifier">DeepCopyByXmlSerializer</span> : 
        <span class="parameter">instance</span> : 'T <span class="keyword">-&gt;</span> 'T  <span class="keyword">when</span> 'T : <span class="keyword">new</span>()</pre></div></div></div><h4>Parameters</h4><dl><dt class="has-text-weight-normal"><span class="parameter">instance</span>  <span class="selflink"><span class="typeparameter">T</span></span></dt><dd>对象实例</dd></dl><h4>Type Parameters</h4><dl><dt class="has-text-weight-normal"><span class="parameter">T</span></dt><dd>对象类型</dd></dl><h4>Return Value</h4><span class="selflink"><span class="typeparameter">T</span></span><br />成功返回一个<span class="typeparameter">T</span>对象，失败抛出<a href="https://learn.microsoft.com/dotnet/api/system.runtime.serialization.serializationexception" target="_blank" rel="noopener noreferrer">SerializationException</a></div><div class="collapsibleAreaRegion"><span class="collapsibleRegionTitle" onclick="SectionExpandCollapse('IDEC')" onkeypress="SectionExpandCollapse_CheckKey('IDEC', event)" tabindex="0"><img id="IDECToggle" class="collapseToggle" src="../icons/SectionExpanded.png" />Exceptions</span></div><div id="IDECSection" class="collapsibleSection"><table><tr><th>Exception</th><th>Condition</th></tr><tr><td><a href="https://learn.microsoft.com/dotnet/api/system.runtime.serialization.serializationexception" target="_blank" rel="noopener noreferrer">SerializationException</a></td><td /></tr></table></div><div class="collapsibleAreaRegion"><span class="collapsibleRegionTitle" onclick="SectionExpandCollapse('seeAlso')" onkeypress="SectionExpandCollapse_CheckKey('seeAlso', event)" tabindex="0"><img id="seeAlsoToggle" class="collapseToggle" src="../icons/SectionExpanded.png" />See Also</span></div><div id="seeAlsoSection" class="collapsibleSection"><h4>Reference</h4><div><a href="2f5029e1-b648-e421-cbb2-b46f11ee13f2.htm">SerializationHelp Class</a></div><div><a href="026ce1e1-007c-0e37-04b4-2e196fe75f90.htm">SosoMS.Common.SystemHelp Namespace</a></div></div></div>
    </div>
    <div id="PageFooter" class="pageFooter" />
  </body>
</html>